package com.example.gokchinesefoodmappcdev.service.impl;

import com.example.gokchinesefoodmappcdev.dao.GoodsAttrValDao;
import com.example.gokchinesefoodmappcdev.dao.GoodsInfoDao;
import com.example.gokchinesefoodmappcdev.entity.dto.GoodsDTO;
import com.example.gokchinesefoodmappcdev.service.GoodsAttrValService;
import com.example.gokchinesefoodmappcdev.service.GoodsInfoService;
import com.example.gokchinesefoodmappcdev.util.ResultData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class GoodsAttrValServiceImpl implements GoodsAttrValService {

    @Autowired
    GoodsAttrValDao goodsAttrValDao;

    @Override
    public ResultData insertAttrVal(Integer attrKeyId, Integer goodId, GoodsDTO goodsInfo) {

        String goodSpeCode = goodsInfo.getGoodSpeCode();
        String attrValue = goodsInfo.getAttrValue();

        int i = goodsAttrValDao.insertAttrVal(attrKeyId, goodId, goodSpeCode,attrValue);
        if(i>0){
            return new ResultData(0,"操作成功!");
        }

        return new ResultData(500,"操作失败");

    }
}
